import sys

from windows.login.views import LoginWindow
from windows.client.views import YeChatWindow
from libs.pyqt5braisedpork.app import BraisedPorkApplication

from neusoft_net2 import settings


class ProcessWindowController:
    """主控窗口控制类"""
    def __init__(self):
        super().__init__()

        self.loginWindow = LoginWindow()
        self.loginWindow.show()

        self.yeChatWindow = YeChatWindow()

        self.signal_binder()

    def signal_binder(self):
        """信号槽绑定"""
        self.loginWindow.pushButton_login.clicked.connect(
            lambda: self.loginWindow.login(self.yeChatWindow)
        )


class MainApplication(BraisedPorkApplication):
    """总应用类"""
    def __init__(self, list_):
        super().__init__(list_)
        self.set_window_icon(settings.WINDOW_ICON_PATH)


if __name__ == '__main__':
    app = MainApplication(["default"])
    main_process = ProcessWindowController()

    sys.exit(app.exec_())
